#!/usr/bin/perl

use strict;

my $streamer = 'rtmp://192.168.xxx.xxx';
my $file = $ENV{QUERY_STRING};

print "Content-type: text/html\n\n";

print <<END;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>OneSeg24 - player</title>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">

var player;
var position = 0;

function playerReady(obj) {
	player = document.getElementById(obj['id']);
	player.addModelListener('TIME', 'timeEvent');
}

function timeEvent(o) {
	position = o.position;
}

function stepSeek(time) {
	player.sendEvent('SEEK', position + time);
}

function resizePlayer(ratio) {
	player.width = 320 * ratio;
	player.height = 180 * ratio + 20;
}

</script>
</head>
<body bgcolor="#000000" text="#ffffff" link="#ffff00" vlink="#ffff00" alink="#ffff00">

<div id="preview">This div will be replaced</div>
<script type="text/javascript">
var s1 = new SWFObject('swf/player.swf','player','480','290','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','autostart=true&streamer=$streamer&file=${file}.flv');
s1.write('preview');
</script>

<a href="javascript:stepSeek(-10)">&lt;&lt;10S</a>
<a href="javascript:stepSeek(30)">30S&gt;&gt;</a>

<a href="javascript:resizePlayer(1)">x1</a>
<a href="javascript:resizePlayer(1.5)">x1.5</a>
<a href="javascript:resizePlayer(2)">x2</a>

</body>
</html>
END

